< previous page page_487 next page >

Page 487
Private Sub dbFind1_Selected(SelectValue As Variant)
    '
    ' re-position record based on return value
    '
    Data1.Recordset.FindFirst Text1.DataField & "=" & SelectValue
    '
End Sub
Now save the form (FRMTEST.FRM) and project (PRJTEST.VBP), then run the test form. When you press the Find button, you should see a dialog box that lists all the records in the table, in Name order (see Figure 12.21).
0487-01.jpg
Figure 12.21.
Running the test form.
When you select a name from the list (highlight a name and press OK or double-click the name), you'll see that the main form returns to focus and the data pointer is moved to display the selected record. You now have a custom control that offers instant "find" features by adding just a few lines of code to your projects.
Using the Data Grid to Create a Subform
In this last section of the chapter, you'll use the data grid to create one of the most common forms of data entry screens, the Subform. Subforms are data entry forms that actually contain

 
< previous page page_487 next page >

If you like this book, buy it!